package com.wxb.hello.activemq.consumer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsMessagingTemplate;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.ProducerCallback;
import org.springframework.stereotype.Component;

import javax.jms.JMSException;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;

/**
 * describe:
 *
 * @author : 王校兵
 * @version : v1.0
 * @time : 2017/7/29  18:49
 */
@Component
public class JmsTemplateDemo {

    @Autowired
    private JmsTemplate jmsTemplate;//使用JmsMessagingTemplate将消息放入队列

    @Autowired
    private Queue queue;

    public void sendSimpleMessage(){
        jmsTemplate.execute(new ProducerCallback<Object>() {
            @Override
            public Object doInJms(Session session, MessageProducer producer) throws JMSException {


                return null;
            }
        });
    }

}
